# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Alex Xu <alex_y_xu@yahoo.ca>

pkgname=nyx
pkgver=2.1.0
pkgrel=6
pkgdesc='Command-line status monitor for tor'
url='https://nyx.torproject.org/'
arch=('any')
license=('GPL-3.0-or-later')
depends=('python' 'python-stem' 'net-tools' 'procps-ng' 'lsof')
makedepends=('python-setuptools')
optdepends=('tor: tor-server to talk to')
source=(https://files.pythonhosted.org/packages/source/${pkgname::1}/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.asc})
sha512sums=('69a645cc811a1b1fbd9cf0501d8f23f1a52e0e92a0598097bb0c9efb040e1895e1dd431bad93be36db0e85ca7ac32ee5c866d50d2812069a39e5160b44575a37'
            'SKIP')
validpgpkeys=('68278CC5DD2D1E85C4E45AD90445B7AB9ABBEEC6') # Damian Johnson (www.atagar.com) <atagar1@gmail.com>

prepare() {
  cd ${pkgname}-${pkgver}
  # remove tests requiring full terminal
  rm -r test/{panel,{popups,subwindow,installation}.py}
  # make test exit on error
  sed -E 's|(test_runner.run\(tests\))|__import__("sys").exit(0 if \1.wasSuccessful() else 1)|' -i run_tests.py
}

build() {
  cd ${pkgname}-${pkgver}
  python setup.py build
}

check() {
  cd ${pkgname}-${pkgver}
  ./run_tests.py
}

package() {
  cd ${pkgname}-${pkgver}
  python setup.py install --optimize=1 --root="${pkgdir}" --skip-build
  install -Dm 644 nyx.1 -t "${pkgdir}/usr/share/man/man1"
}

# vim: ts=2 sw=2 et:
